import HomePage from '@/pages/HomePage.vue'
import UserLoginPage from '@/pages/user/UserLoginPage.vue'
import UserRegisterPage from '@/pages/user/UserRegisterPage.vue'
import UserManagePage from '@/pages/admin/UserManagePage.vue'
import ACCESS_ENUM from '@/access/accessEnum.ts'
import type { RouteRecordRaw } from 'vue-router'
import UserLayout from '@/layouts/UserLayout.vue'

export const routes: Array<RouteRecordRaw> =[

  {
    path: '/user',
    name: '用户',
    component: UserLayout,
    children: [
      {
        path: 'login',
        name: '用户登录',
        component: UserLoginPage
      },
      {
        path: 'register',
        name: '用户注册',
        component: UserRegisterPage
      }
    ],
    meta: {
      hideinmenu: true
    }
  },
  {
    path: '/',
    name: '主页',
    component: HomePage,
  },
  {
    path: '/admin/userManage',
    name: '用户管理',
    component: UserManagePage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: '/about',
    name: '关于我的',
    // route level code-splitting
    // this generates a separate chunk (About.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('@/pages/AboutView.vue'),
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
]
